<?php


namespace app\xiangji\controller;


use app\Request;
use app\xiangji\BaseController;
use app\xiangji\services\SmsService;
use think\App;

class Sms extends BaseController
{
    private $smsService;

    public function __construct(SmsService $smsService)
    {
        $this->smsService = $smsService;
    }

    /**
     * @todo 发送手机短信
     * @param Request $request
     * @return \think\response\Json
     * @throws \think\Exception
     */
    public function sendSms(Request $request)
    {
        // 不同场景调用不同方法发送短信
        switch ($request->post('action')){
            case 'modify_mobile': {
                $result = $this->smsService->sendModifyMobileCode($request->post('mobile'));  // 修改手机号
            }
        }
        return $this->success($result);
    }
}